package com.jiaai.web.zfp_back.anchor;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jiaai.live.api.IAnchorLevelApi;
import com.jiaai.live.model.AnchorLevelVO;
import com.jiaai.util.RestResultGenerator;
import org.springframework.web.bind.annotation.*;

/**
 * class_name:ZBAnchorLevelConfiController
 * describe:TODO
 * create_user:张昉平
 * create_date:2017/12/19
 * create_date:11:12
 */
@RestController
@RequestMapping("/api/v1/admin/alevelconfig")
public class ZBAnchorLevelConfiController {

    @Reference
    private IAnchorLevelApi anchorLevelApi;

    @GetMapping("/list")
    public Object list(@RequestParam Integer curr){
        return RestResultGenerator.genSuccessResult(anchorLevelApi.getAll(curr));
    }

    @PostMapping("/saveoredit")
    public Object saveOrEdit(@RequestBody AnchorLevelVO anchorLevelVO){
        anchorLevelApi.saveOrUpdate(anchorLevelVO);
        return RestResultGenerator.genSuccessResult("成功");
    }

    @PostMapping("/delete/{id}")
    public Object delete(@PathVariable Integer id){
        anchorLevelApi.delete(id);
        return RestResultGenerator.genSuccessResult("成功");
    }
}
